/* @(#)GSBusOrderRefundListAction.java    V0.1
 *
 * Project: GSdevelop
 * add by Jackey
 * 2007-02-28
 * 
 */
package com.hitrust.gs.action;

import java.util.ArrayList;
import java.util.HashMap;

import com.hitrust.gs.bean.GSOperatorBean;
import com.hitrust.gs.business.GSManufactureProcessor;
import com.hitrust.gs.business.GSOrderDeptInfoProcessor;
import com.hitrust.gs.business.GSOrderProcessor;
import com.hitrust.gs.form.GSBusOrderRefundListForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.util.page.ResultProcess;
import com.hitrust.gs.vo.GSBusOrderRefundVO;

/**
 * 查询巴士物资退货管理列表
 */
public class GSBusOrderRefundListAction extends GSBaseAction{

    /* (non-Javadoc)
     * @see com.hitrust.gs.service.GSBaseAction#execute(com.hitrust.gs.service.GSBaseForm)
     */
    public String execute(GSBaseForm aForm) throws Exception {
        GSBusOrderRefundListForm tForm = (GSBusOrderRefundListForm)aForm;
        GSBusOrderRefundVO tGSBusOrderRefundVO=new GSBusOrderRefundVO();
        tGSBusOrderRefundVO.orderid = tForm.orderdetailId;
        tGSBusOrderRefundVO.orderDeptId = tForm.orderDeptId;
        tGSBusOrderRefundVO.deliverGoodsAddrId = tForm.deliverGoodsAddrId;
        tGSBusOrderRefundVO.manufInfo = tForm.manufInfo;
        tGSBusOrderRefundVO.concentricityId = tForm.concentricityId;
        tGSBusOrderRefundVO.orderCreateDateStr = tForm.orderCreateDateStr;
        tGSBusOrderRefundVO.orderCreateDateEnd = tForm.orderCreateDateEnd;
        tGSBusOrderRefundVO.orderDetailStatus = tForm.orderStatus;
        tGSBusOrderRefundVO.providerId = tForm.providerId;
        tGSBusOrderRefundVO.manufType1 = tForm.manuftype1;
        tGSBusOrderRefundVO.manufType2 = tForm.manuftype2;
        tGSBusOrderRefundVO.manufType3 = tForm.manuftype3;
        
//        String  tManuftype1=tForm.manuftype1;
//        String  tManuftype2=tForm.manuftype2;
//        String  tManuftype3=tForm.manuftype3;
//        if(tManuftype1.equals("0")){
//            tGSBusOrderRefundVO.category="";
//        }
//        else if(tManuftype2.equals("0")){
//            tGSBusOrderRefundVO.category=tManuftype1;
//        }
//        else if(tManuftype3.equals("0")){
//            tGSBusOrderRefundVO.category=tManuftype2;
//        }
//        else{
//            tGSBusOrderRefundVO.category=tManuftype3;
//        }
        try{
            GSOrderProcessor tProc = new GSOrderProcessor();
//          巴士物资级操作员可操作订货单位及送货地址
            GSOrderDeptInfoProcessor tOrderDeptInfoProc = new GSOrderDeptInfoProcessor();
            GSOperatorBean tOperBean = (GSOperatorBean)aForm.getSession().getAttribute(GSBaseConstants.LOGIN);
            HashMap tMap = tOrderDeptInfoProc.getOrderDeptInfoOfBusOper(tOperBean.getGs_oper_org_id());
            aForm.getRequest().setAttribute("orderdept",tMap);
//          查询当前操作员所能操作的订货单位
            ArrayList tOrg = (ArrayList)tMap.get("organization");
            
            ArrayList tList = tProc.getBusRefundOrderAndDetail(tGSBusOrderRefundVO,tOrg);
            ResultProcess tRsProc = new ResultProcess();
            tRsProc.setResult(tList);
            tForm.getRequest().setAttribute("order",tRsProc);
            aForm.getRequest().setAttribute("orderStatus",tForm.orderStatus);
    
            
            
            //种类等级
            GSManufactureProcessor tGSManufProcessor = new GSManufactureProcessor();
            tGSManufProcessor.getManufactureOfLevel(aForm);
            aForm.getRequest().setAttribute("requery","false");
        }
        catch(Exception e){
            tForm.getRequest().setAttribute("action","A155001.do");
            throw e;
        }
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
